﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EntityModels
{
    /// <summary>
    /// 基于配置类的配置
    /// </summary>
    public class SimpleEntityConfiguration : IEntityTypeConfiguration<SimpleEntity>
    {
        public void Configure(EntityTypeBuilder<SimpleEntity> builder)
        {
            builder.Property(s => s.SimpleEntityId).IsRequired();

            builder.Property(s => s.Text).IsRequired().HasMaxLength(50);
        }

    }
}
